<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:78:"E:\phpstudy_pro\WWW\nmg03\public/../application/admin\view\courses\course.html";i:1704537444;}*/ ?>
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> <?php echo $setting['webname']; ?>- 课程列表</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="/public/static/favicon.ico"> <link href="/public/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/public/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/static/admin/css/animate.css" rel="stylesheet">
    <link href="/public/static/admin/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-sm-4">
            <h2>专业管理</h2>
            <ol class="breadcrumb">
                <li>
                    <a href="<?php echo url('Admins/admin'); ?>">主页</a>
                </li>
                <li>
                    <strong>课程管理</strong>
                </li>
            </ol>
        </div>
    </div>
    <div class="wrapper wrapper-content animated fadeIn">
        <div class="row">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <ul class="nav nav-tabs" id="table-title">
                        <?php foreach($list as $v): ?>
                            <li id="type<?php echo $v['id']; ?>" data-id="<?php echo $v['id']; ?>"><a data-toggle="tab" href="#tab-<?php echo $v['id']; ?>"  aria-expanded="true"> <?php echo $v['name']; ?></a></li>
                        <?php endforeach; ?>
                    </ul>
                    <div class="tab-content">
                        <?php foreach($list as $v): ?>
                        <!--新闻列表开始-->
                        <div id="tab-<?php echo $v['id']; ?>" class="tab-pane">
                            <div class="panel-body">

                                <!--行开始-->
                                <table class="table table-striped">
                                    <tr>
                                        <th>编号</th>
                                        <th>课程名称</th>
                                        <th>课时（节）</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php if(empty($v['newslist'])): ?>
                                    暂无数据
                                    <?php endif;  $i = 1;  foreach($v['newslist'] as $vs): ?>
                                    <tr>
                                        <td><?php echo $i; ?></td>
                                        <td><?php echo $vs['name']; ?></td>
                                        <td><?php echo $vs['course_time']; ?></td>
                                        <td class="tools"><a href="<?php echo url('Courses/majorcourse_update'); ?>?id=<?php echo $vs['id']; ?>"><i class="glyphicon glyphicon-pencil" style="color:#19a9d5"></i></a> &nbsp; <a class="del" data-id="<?php echo $vs['id']; ?>" data-name="<?php echo $vs['name']; ?>" data-typeid="<?php echo $v['id']; ?>"><i class="glyphicon glyphicon-trash"style="color:#19a9d5"></i></a></td>
                                    </tr>
                                    <?php $i++; endforeach; ?>
                                </table>
                                <!--行结束-->
                                <?php echo $v['newslist']->render(); ?>
                            </div>

                        </div>
                        <!-- 新闻列表结束 -->
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
        </div>
       
    </div>


    <!-- 全局js -->
    <script src="/public/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/public/static/admin/js/bootstrap.min.js?v=3.3.6"></script>



    <!-- 自定义js -->
    <script src="/public/static/admin/js/content.js?v=1.0.0"></script>
    <script src="/public/static/admin/layui/layui.js"></script>
    <script>
        $("#type<?php echo $activeid; ?>").attr("class","active");
        $("#tab-<?php echo $activeid; ?>").attr("class","tab-pane active");
        layui.use('layer', function(){ //独立版的layer无需执行这一句
            var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
            //点击提交
            $(".del").click(function(){
                var s = $(this);
                top.layer.msg('你确定要删除“'+s.data('name')+'”这个课程吗？', {
                    time: 20000, //20s后自动关闭
                    shade: 0.8,
                    btn: ['确定', '取消'],
                    btn1:function(){
                        $.post("<?php echo url('Courses/deletes'); ?>",{id:s.data('id'),typeid:s.data('typeid')},function(data){
                            top.layer.closeAll();
                            top.layer.msg(data.msg,{time:2000,shade:0.5},function(){
                                if(data.url){
                                    window.location.href = data.url;
                                }
                            });
                        });
                    }
                });

            });
        });
    </script>

    
    

</body>

</html>
